#!/bin/bash
echo -e  "\e[32m=======开始安装kibana========\e[0m"
if ! docker images | grep "kibana.*7.4.2.*" >/dev/null
then

        echo -e  "\e[33m=======开始拉取kibana镜像========\e[0m"
        docker pull kibana:7.4.2
        echo -e  "\e[33m=======镜像拉取完成========\e[0m"
fi
if docker ps -a | grep "kibana$" &>/dev/null
then
        docker rm -f  kibana &>/dev/null
fi
#启动容器
IP=http://$(curl ifconfig.me):9200
docker run --name kibana -e ELASTICSEARCH_HOSTS=$IP -p 5601:5601 --restart=always \
-d kibana:7.4.2 >/dev/null
echo -e "\e[32m======kibana安装完成========\e[0m"
